package com.lagou.service.impl;

import com.lagou.service.HelloService;
import com.lagou.service.TestService;
import org.apache.dubbo.config.annotation.Service;

import java.util.concurrent.TimeUnit;

@Service
public class TestServiceImpl implements TestService {


    @Override
    public String methodA(String name, int timeToWait) {
        sleeps();
        return "methodA";
    }

    @Override
    public String methodB(String name, int timeToWait) {
        sleeps();
        return "methodB";
    }

    @Override
    public String methodC(String name, int timeToWait) {
        sleeps();
        return "methodC";
    }

    private void sleeps(){
        try {
            Integer cc = (int) (Math.random() * 100);
            Thread.sleep(cc.longValue());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
